//
//  CommentViewModel.m
//  HiCar
//
//  Created by huachun on 2019/4/12.
//  Copyright © 2019 丁一. All rights reserved.
//

#import "CommentViewModel.h"
#import "HJonesNetting.h"

@implementation CommentViewModel

- (instancetype)init:(id)responseObject{
    if (self = [super init]) {
        
        [HJonesNetting JonesNetting_POST:responseObject andURL:App_HOME_AddComment andtimeout:20.0 finished:^(NSError * _Nonnull error, NSDictionary * _Nonnull resultDict) {
            if (error) {
                [SVProgressHUD showErrorWithStatus:@"网络加载失败"];
                [self.delegate CommentSucces:0 dic:nil];
            }else{
                if ([[resultDict objectForKey:@"Code"] longLongValue]==1000) {

                    [self.delegate CommentSucces:1 dic:resultDict];
                    
                }else{
                    
                    [SVProgressHUD showErrorWithStatus:[resultDict objectForKey:@"Message"]];
                    
                    [self.delegate CommentSucces:0 dic:nil];
                }
            }
        } passmanger:^(NSURLSessionDataTask * _Nonnull manger) {
            
        } andprogress:^(NSProgress * _Nonnull CProgress) {
            
        }];
        
    }
    return self;
}

@end
